package org.pjsip.constant;

/**
 * author : GWFan
 * time   : 1/20/21 3:14 PM
 * desc   :
 */


public enum SipStatus {

    SIP_STATUS_ERROR(-1, "错误"),
    SIP_STATUS_0(0, "无通话"),
    SIP_STATUS_1(1, "正在外呼"),
    SIP_STATUS_2(2, "收到来电"),
    SIP_STATUS_3(3, "已振铃"),
    SIP_STATUS_4(4, "响应"),
    SIP_STATUS_5(5, "接通"),
    SIP_STATUS_6(6, "挂断");
    private final int key;
    private final String value;

    SipStatus(int key, String value) {
        this.key = key;
        this.value = value;
    }

    public int getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }

    public static String getValueByKey(int key) {
        for (SipStatus sipStatus : SipStatus.values()) {
            if (sipStatus.getKey() == key) {
                return sipStatus.getValue();
            }
        }
        return SIP_STATUS_0.value;
    }
}

